fix(appconfig): relevant KMS permissions missing for encrypted SQS destinations #35194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #35180.
Reason for this change
AWS AppConfig extensions with encrypted SQS destinations were failing silently because the
SqsDestinationclass only grantedsqs:SendMessagepermissions but omitted the required KMS permissions (kms:Decryptandkms:GenerateDataKey) needed to work with customer-managed KMS encrypted queues.This caused a poor user experience where AppConfig extensions would appear to be configured correctly but would fail to deliver messages to encrypted SQS queues without any error indication. Users were forced to either disable encryption or manually add KMS permissions, preventing secure-by-default practices.
Description of changes
This change adds conditional KMS permission granting to the
SqsDestinationclass in AWS AppConfig extensions:queue.encryptionMasterKeyand conditionally add KMS permissions when presentkms:Decryptandkms:GenerateDataKeyactions on the queue's encryption key when a customer-managed KMS key is detectedKey implementation details:
SqsDestinationwhich correctly handles this scenarioqueue.encryptionMasterKeyproperty to detect encrypted queuesDesign decisions:
queue.grantSendMessages()to maintain consistency with existing AppConfig patterns and provide explicit control over permissionsDescribe any new or updated permissions being added
IAM permissions added conditionally:
kms:Decrypt: Required for AppConfig to decrypt messages from encrypted SQS queueskms:GenerateDataKey: Required for AppConfig to encrypt messages when sending to encrypted SQS queuesThese permissions are only added when:
queue.encryptionMasterKeyis present)Security impact: This change improves security by enabling encrypted SQS queues to work correctly with AppConfig extensions, promoting secure-by-default practices. The permissions follow the principle of least privilege and are only granted when necessary.
Description of how you validated changes
Unit tests (108/108 passing):
kms:Decrypt,kms:GenerateDataKey) are correctly added to IAM policies when using customer-managed KMS encrypted queuesIntegration tests (1/1 passing):
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license